Skip to content

Add copyright headers to generated code and Getting Help to README#23

Merged
guenp merged 12 commits into
mainfrom
add-copyright-headers-and-getting-help
Apr 26, 2026
Merged

Add copyright headers to generated code and Getting Help to README#23
guenp merged 12 commits into
mainfrom
add-copyright-headers-and-getting-help

Conversation

@splch

@splch splch commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two small open-source hygiene items:

  1. Copyright headers on generated code (Add copyright headers to generated code templates #18) - Adds a post-generation hook to openapi-python-client-config.yaml that prepends the # Copyright 2026 IonQ, Inc. / SPDX-License-Identifier: Apache-2.0 header to all generated .py files. Hand-written files are skipped (they already have it). The hook runs before ruff check/ruff format, so formatting is preserved.

  2. Getting Help section in README (Add Getting Help section to README #19) - Adds a section directing users to GitHub Issues for bugs, IonQ Support for account/billing, and docs.ionq.com for API docs.

Closes #18, closes #19.

Test plan

  • uv run pytest - all 218 tests pass, 100% coverage
  • Dry-ran the copyright hook against the current ionq_core/ tree - correctly identifies all headerless generated files and skips hand-written files that already have the header

Important

Most code in ionq_core/ is auto-generated. Do not edit files under ionq_core/api/,
ionq_core/models/, or ionq_core/client.py, errors.py, types.py directly.
See CONTRIBUTING.md for details.

splch and others added 11 commits April 24, 2026 11:39
Add a post-generation hook that prepends the Apache-2.0 copyright header
to all generated .py files that don't already have one. Hand-written
files are skipped since they already carry the header.

Add a Getting Help section to the README directing users to GitHub Issues
for bugs, IonQ Support for account questions, and docs.ionq.com for API
documentation.

Closes #18, closes #19.
Generated files are always fresh - no need to check for existing headers.
Replace verbose Python __import__/pathlib one-liners with concise
perl -pi -e commands for both the token repr and copyright header
post hooks. Both are shorter, use the same tool, and are
cross-platform (macOS + Linux).
The staleness CI check failed because the post-generation hook
was prepending copyright headers to files that already had them,
producing duplicates. Removing the hand-written headers lets the
hook handle all files uniformly.
Run the generator so the post-hook adds copyright headers to all
.py files, matching what the staleness CI check produces.
Skip files that already start with '# Copyright' so the hook
does not duplicate headers on handwritten files that the generator
leaves untouched.
Use -0777 slurp mode with a single substitution instead of
line-by-line processing with a per-file hash tracker.
Removed detailed package documentation and examples from the Jinja template.
@guenp

guenp commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

@splch can you check that I resolved this merge conflict correctly?
https://github.com/ionq/ionq-core-python/blob/add-copyright-headers-and-getting-help/custom-templates/package_init.py.jinja

The merge from main lost the imports and __all__ from the
package_init template and re-introduced the copyright header
that the post-hook now handles.
@splch

splch commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator Author

@splch can you check that I resolved this merge conflict correctly? https://github.com/ionq/ionq-core-python/blob/add-copyright-headers-and-getting-help/custom-templates/package_init.py.jinja

just got it fixed up! no problem :)

@guenp guenp merged commit 6dcbce9 into main Apr 26, 2026
10 checks passed
@guenp guenp deleted the add-copyright-headers-and-getting-help branch April 26, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Getting Help section to README Add copyright headers to generated code templates

2 participants